/*
 * Copyright (c) 悠静<i@mikuhl.cn> 仅用于提交给24年JavaWeb课程所用，侵权必究. 2024-至今. All rights reserved.
 *
 */

package cn.mikuhl.retailmanagementsystem.Service;

import cn.mikuhl.retailmanagementsystem.DAO.ProductMapper;
import cn.mikuhl.retailmanagementsystem.Entities.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductService {
    @Autowired
    private ProductMapper productMapper;

    public List<Product> getAllProducts() {
        return productMapper.getAllProducts();
    }

    public Product getProductById(int id) {
        return productMapper.getProductById(id);
    }

    public void insertProduct(Product product) {
        productMapper.insertProduct(product);
    }

    public void updateProduct(Product product) {
        productMapper.updateProduct(product);
    }

    public void deleteProduct(int id) {
        productMapper.deleteProduct(id);
    }
}
